package com.itoffer.mapper;

import com.itoffer.pojo.ResumeBasicInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ResumeMapper {

    /**
     * 添加简历信息
     *
     * @param basicInfo
     * @param applicant_id
     * @return
     */
    int addResume(@Param("basicInfo") ResumeBasicInfo basicInfo, @Param("applicant_id") int applicant_id);

    /**
     * 通过applicant_id查询是否有简历信息
     */
    @Select("select basicinfo_id from tb_resume_basicinfo where applicant_id =#{applicant_id}")
    Integer selectResumeByApplicant_id(@Param("applicant_id") int applicant_id);

    /**
     * 回显数据信息
     * @param basicinfo_id
     */
    @Select("select * from tb_resume_basicinfo where basicinfo_id = #{basicinfo_id}")
    ResumeBasicInfo selectCurrentResume(int basicinfo_id);


    /**
     * 通过applicant_id查询basicinfo_id
     * @param applicant_id
     * @return
     */
    @Select("select basicinfo_id from tb_resume_basicinfo where applicant_id = #{applicant_id}")
    int selectBasicinfo_idByApplicant_id(int applicant_id);


    @Update("update tb_resume_basicinfo set head_shot = #{newFileName} where basicinfo_id = #{basicinfo_id} ")
    void updatePicPath(@Param("basicinfo_id") int basicinfo_id,@Param("newFileName") String newFileName);


    @Update("update tb_resume_basicinfo set realname = #{realname},gender = #{gender},birthday = #{birthday},telephone = #{telephone},email = #{email},job_intension = #{job_intension},job_experience = #{job_experience} where  basicinfo_id = #{basicinfo_id}")
    int updateResume(ResumeBasicInfo basicInfo);


}
